import 'package:flutter/material.dart';
import 'package:p_location/common/obj/common_colors.dart';

class SplitTitleView extends StatelessWidget {
  final String title;
  final Color textColor;
  final Color backgroundColor;
  final bool hasRightArrow;
  final bool isTopArrow;

  SplitTitleView(this.title,
      {this.textColor = CommonColors.MAIN_BLUE_COLOR,
      this.backgroundColor: Colors.white,
      this.hasRightArrow = false,
      this.isTopArrow = false});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 40,
      padding: EdgeInsets.only(left: 20, right: 10, top: 0, bottom: 0),
      color: backgroundColor,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(
            title,
            style: TextStyle(color: textColor),
          ),
          Offstage(
            offstage: !hasRightArrow,
            child: IconButton(
              onPressed: null,
              icon: Icon(isTopArrow
                  ? Icons.keyboard_arrow_down
                  : Icons.keyboard_arrow_right),
              color: Color.fromRGBO(0, 0, 0, 0.45),
            ),
          )
        ],
      ),
    );
  }
}
